<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
cfc('core')->checklogin('jy_jdpm/member.index/');
$return=array();
if($_RQ['op']=='main'){
	$id=$_RQ['order_no'];
	if(!$id){
		exi('错误订单id','error');
	}
	$info1 = pdo_get('jy_jdpm_order',array('order_no'=>$id));
	$info2 = pdo_get('jy_jdpm_order_return',array('order_no'=>$id),array('time5','time6','time7','time8','time9','deftime6','deftime8','deftime9','deftime6','deftime6','express_no','express','address'));
	$info=array_merge($info1,$info2);
	if($info1['status']==8){
		$info['express']=$info2['express'];
		$info['express_no']=$info2['express_no'];
	}else{
		$info['express']=$info1['express'];
		$info['express_no']=$info1['express_no'];
	}
	if($info1['rstatus']==1){
		$info['address']=$info2['address'];
		
	}else{
		$info['address']=$info1['address'];
	}
	$info['name']=pdo_getcolumn('jy_jdpm_auction',array('pid'=>$info1['pid']),'pname');
	$info['starttime']=pdo_getcolumn('jy_jdpm_auction',array('pid'=>$info1['pid']),'starttime');
	$info['endtime']=pdo_getcolumn('jy_jdpm_auction',array('pid'=>$info1['pid']),'endtime');
	$info['onset']=pdo_getcolumn('jy_jdpm_auction',array('pid'=>$info1['pid']),'onset');
	$good=pdo_get('jy_jdpm_goods',array('id'=>$info['goodsid']),array('images'));
	$images=explode('|',$good['images']);
	$info['image']=$images;
	$info['total']=$info['price']+$info['freight'];
	$info['createtime']=date('Y/m/d H:i:s',$info['createtime']);
	$info['time1']=date('Y/m/d H:i:s',$info['time1']);
	$info['time2']=date('Y/m/d H:i:s',$info['time2']);
	$info['getgoodstime']=date('Y/m/d H:i:s',$info['getgoodstime']);
	$info['time4']=date('Y/m/d H:i:s',$info['time4']);
	$info['time5']=date('Y/m/d H:i:s',$info['time5']);
	$info['time6']=date('Y/m/d H:i:s',$info['time6']);
	$info['time7']=date('Y/m/d H:i:s',$info['time7']);
	$info['time8']=date('Y/m/d H:i:s',$info['time8']);
	$info['time9']=date('Y/m/d H:i:s',$info['time9']);
	$info['time10']=date('Y/m/d H:i:s',$info['time10']);	
	$info['deftime1']=date('Y/m/d H:i:s',$info['deftime1']);
	$info['deftime2']=date('Y/m/d H:i:s',$info['deftime2']);
	$info['defgetgoodstime']=date('Y/m/d H:i:s',$info['defgetgoodstime']);
	$info['deftime4']=date('Y/m/d H:i:s',$info['deftime4']);
	$info['deftime6']=date('Y/m/d H:i:s',$info['deftime6']);
	$info['deftime8']=date('Y/m/d H:i:s',$info['deftime8']);
	$info['deftime9']=date('Y/m/d H:i:s',$info['deftime9']);
	$info['deftime10']=date('Y/m/d H:i:s',$info['deftime10']);
	$info['address']=json_decode($info['address'],true);
	$return['orderinfo']=$info;
	exi($return);
}
if($_RQ['op']=='receive'){
	//确认收货
	$id=$_RQ['order_no'];
	if(!$id){
		exi('请先选择订单！','error');
	}
	$orderset=plugin_set2('order');
	$orderset['endtime']=$orderset['endtime']?$orderset['endtime']:3;
	$deftime10=$orderset['endtime']*24*3600 + TIMESTAMP;
	pdo_update('jy_jdpm_order',array('status'=>9,'getgoodstime'=>TIMESTAMP,'defgetgoodstimest'=>1,'deftime10st'=>0,'deftime10'=>$deftime10),array('order_no'=>$id));
	exi('确认收货成功！','','jy_jdpm/member.order/list');
}